package com.api.regression.group.editmember;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import com.api.test.AbstractApiTest;
import com.zyncro.api.IGroupApiService;
import com.zyncro.api.exceptions.ZyncroApiException;

@ContextConfiguration(locations = { "classpath:/group/group-context.xml" })
public class EditMemberNotOwner extends AbstractApiTest {

	@Value("#{groupmembers['user.notOwner'].appId}")
	private String userUrn;

	@Value("#{groupmembers['user.notOwner'].password}")
	private String userPassword;

	@Value("#{groupmembers['group.toEdit'].urn}")
	private String groupUrn;

	@Value("#{groupmembers['user.toEdit'].appId}")
	private String memberToEditUrn;

	@BeforeClass
	public void loginUser() {

		getApi().login(userUrn, userPassword);
	}

	@Test(expectedExceptions = { ZyncroApiException.class })
	public void testEditMember() throws ZyncroApiException {

		boolean isEditor = true;
		boolean isTaskManager = true;
		boolean isInviter = true;
		boolean isCommenter = true;
		boolean isOwner = true;

		getApi().getService(IGroupApiService.class).editMember(groupUrn, memberToEditUrn, isEditor, isTaskManager, isInviter, isCommenter,
				isOwner);
	}
}
